Automatic focusing apparatus and control method therefor

ABSTRACT

An automatic focusing apparatus detects presence or absence of change in a distance between an object and the automatic focusing apparatus while operating in an operation mode to continuously perform an adjustment of the position of a focus lens to focus on the object, and stops a movement of the focus lens if a change in the distance is not detected.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a Continuation of U.S. patent application Ser. No.14/276,808 filed May 13, 2014, which is a Continuation of U.S. patentapplication Ser. No. 12/560,212 filed Sep. 15, 2009, which claims thebenefit of Japanese Patent Application No. 2008-237187 filed Sep. 16,2008, all of which are hereby incorporated by reference in theirentirety.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an automatic focusing apparatus, e.g.,a camera, and a control method therefor.

2. Description of the Related Art

Conventionally, an automatic focusing apparatus of an auto-focusing (AF)system which focuses on an object by moving a focus lens positionaccording to a luminance signal obtained from an image sensor, such as acharge-coupled device (CCD), has been used in an electronic still cameraor the like. In the automatic focusing apparatus, a focus evaluationvalue indicating a contrast within an AF area is calculated byintegrating high-frequency components of a signal in the AF area setwithin an image plane. Then, a focus detection operation for acquiring afocus evaluation value for each position of a focus lens is performed byshifting the focus lens, to detect a position of the focus lens enablingthe highest focus evaluation value, which is regarded as an in-focuspoint. Further, in an automatic focusing apparatus of the AF system, byrepeatedly performing the focus detection operation, focusing can bealso achieved on a moving object by tracking it.

As a technology relating to an automatic focusing apparatus which alsoenables focusing with respect to a moving object by tracking it,Japanese Patent Application Laid-Open No. 2004-212556, and JapanesePatent Application Laid-Open No. 2007-206433 are known. Japanese PatentApplication Laid-Open No. 2004-212556 discusses an imaging apparatusequipped with an automatic focusing apparatus which causes an AFtracking to an object to be performed by repeating a focus detectionoperation by a lens movement before shooting. Further, Japanese PatentApplication Laid-Open No. 2007-206433 discusses a technology for storingin advance in-focus positions after having performed the focus detectionoperation for each shooting, in a continuous shooting or the like,predicting an in-focus position before a next shooting based on theprevious in-focus positions previously stored, thus determining a rangefor a focus detection operation.

However, in the above-described conventional technology, even in a casewhere a distance between an automatic focusing apparatus and an objecthas not changed, e.g., the object comes to rest, a focus detectionoperation is continuously performed so that the focus lens issequentially moved. For this reason, a focus fluctuation always occurs,and a tracking ability to the object may deteriorate. In particular, inan electronic viewfinder (EVF) display using consecutive capturedimages, or the like, frames which are out-of focus may be generated, andaccordingly visual quality may degrade. Further, the focus lens issequentially moved, thus leading to an increase in battery consumption.

SUMMARY OF THE INVENTION

The present invention is directed to an automatic focusing apparatuscapable of preventing tracking ability to an object from deteriorating,even if a distance between the automatic focusing apparatus and theobject does not change, when continuously performing an adjustment ofposition of a focus lens to make focus on an object, and to a controlmethod therefor.

According to an aspect of the present invention, an automatic focusingapparatus includes an imaging unit configured to capture an object imagethat is input via a focus lens to output image data, a detection unitconfigured to detect a focus signal that indicates a focusing state ofthe focus lens based on the image data, a focus adjustment unitconfigured to adjust a position of the focus lens based on the focussignal detected by the detection unit, a control unit configured tocause the focus adjustment unit to operate in an operation mode tocontinuously perform an adjustment of the position of the focus lens,and a distance change detection unit configured to detect, when thefocus adjustment unit is operating in the operation mode, presence orabsence of change in a distance between the object and the automaticfocusing apparatus, wherein the control unit stops the adjustment of theposition of the focus lens if a change in the distance is not detectedby the distance change detection unit.

Further features and aspects of the present invention will becomeapparent from the following detailed description of exemplaryembodiments with reference to the attached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate exemplary embodiments, features,and aspects of the invention and, together with the description, serveto explain the principles of the invention.

FIG. 1 is a block diagram illustrating a configuration of an imagingapparatus according to an exemplary embodiment of the present invention.

FIG. 2 is a flowchart illustrating an operation of the imagingapparatus.

FIG. 3 is a flowchart illustrating a subroutine of a continuous AFoperation.

FIG. 4 is a flowchart illustrating a subroutine of a servo AF operation.

FIG. 5 is a flowchart illustrating a subroutine of a hill-climbing AFoperation.

FIG. 6 is a flowchart illustrating a subroutine of determining whetherobject distance has changed.

FIG. 7 is a flowchart illustrating a subroutine of a normal AFoperation.

FIG. 8 is a flowchart illustrating a subroutine of a continuous servo AFoperation.

FIG. 9 is a flowchart illustrating a subroutine of a determiningpredictability.

FIG. 10 is a flowchart illustrating a subroutine of predicting an objectposition.

FIG. 11A is a conceptual view illustrating a calculation of objectposition prediction at two points. FIG. 11B is a conceptual viewillustrating a calculation of object position prediction at threepoints.

FIG. 12 is a flowchart illustrating a subroutine of scanning.

FIG. 13 is a graph illustrating a relationship between a focusevaluation value and a focus lens position.

FIG. 14 is a flowchart illustrating a subroutine of an in-focusdetermination.

FIG. 15 is a flowchart illustrating a checking for a monotonic decreasein an infinite distance end direction.

FIG. 16 is a flowchart illustrating a checking for a monotonic decreasein a closest end direction.

FIG. 17 is a flowchart illustrating a subroutine of a shootingoperation.

DESCRIPTION OF THE EMBODIMENTS

Various exemplary embodiments, features, and aspects of the inventionwill be described in detail below with reference to the drawings.

FIG. 1 is a block diagram illustrating a configuration of an imagingapparatus 1 according to an exemplary embodiment of the presentinvention. As illustrated in FIG. 1, the imaging apparatus 1 is anelectronic still camera, which captures an image by an image sensor 108,the image being formed via a photographic optical system including aphotographic lens 101, a diaphragm and shutter 102, and a focus lens104. Further, the imaging apparatus 1 includes an AF processing unit105, which moves the focus lens 104 under the control of a control unit115, and is configured to perform focus adjustment by moving the focuslens 104 according to image data captured by the image sensor 108.

The photographic lens 101 is an optical lens including a zoom mechanismand so on. The diaphragm and shutter 102 controls a light amount from anobject according to control of an AE processing unit 103 (AE: automaticexposure). The AE processing unit 103 controls an aperture value and ashutter speed of the diaphragm and shutter 102 under the control of thecontrol unit 115. The focus lens 104 is moved along an optical axis byan actuator (not illustrated), which moves in response to control of theAF processing unit 105. Thereby, the focus lens 104 performs focusadjustment of an image obtained in the image sensor 108. The AFprocessing unit 105 controls a movement of the focus lens 104 under thecontrol of the control unit 115 (the details will be described below).Therefore, reflected light from the object enters the photographic lens101 and subsequently an amount of exposure is adjusted via the diaphragmand shutter 102, and an image is formed by the focus lens 104 andcaptured by the image sensor 108.

A flash unit 106 emits auxiliary light to the object in response to thecontrol of an EF processing unit 107 (EF: pre-flash). The EF processingunit 107 controls a light emission of the flash unit 106 under thecontrol of the control unit 115. For example, the EF processing unit 107causes the flash unit 106 to perform a preliminary light emission,before a main shooting by the image sensor 108 performed under thecontrol of the control unit 115, and detects an amount of reflectedlight from the object by a sensor (not illustrated), and calculates anamount of light emission during a main flash. Subsequently, the EFprocessing unit 107 causes the flash unit 106 to execute a lightemission with calculated amount of light emission, at the time of themain shooting, thereby subjecting the object to a correct exposure.

The image sensor 108 outputs an image formed by the focus lens 104 asimage data converted into an electrical analog signal by photoelectricconversion. More specifically, the image sensor 108 is typically acharge-coupled device (CCD) or a complementary metal-oxide semiconductor(CMOS) sensor or the like. An analog-to-digital (A/D) conversion unit109 converts analog image data, which is output from the image sensor108, into digital image data. Alternatively, the A/D conversion unit 109may be configured to include a correlated double sampling (CDS) circuit,which eliminates an output noise of the image sensor 108, and anonlinear amplifier circuit operable before A/C conversion.

An image processing unit 110 performs various image processes on digitalimage data output from the A/D conversion unit 109, and outputsprocessed digital image data. A white balance (WB) processing unit 111performs white balance processing on image-processed digital image dataoutput from the processing unit 110. A format conversion unit 112converts a data format of the image-processed digital image data outputfrom the image processing unit 110 into a predetermined image formatsuch as a Joint Photographic Experts Group (JPEG).

A dynamic random access memory (DRAM) 113 temporarily stores image dataconverted into a predetermined image format by the format conversionunit 112. Further, the DRAM 113 may be used as a work area for thecontrol unit 115 and a work area for compression/decompression of theimage data. An image recording unit 114 includes a recording medium,such as a memory card, and an interface of the recording medium (eitherof them not illustrated). The image recording unit 114 records digitalimage data captured by the image sensor 108, under the control of thecontrol unit 115 and temporarily stored in the DRAM 113, in therecording medium. Alternatively, the recording medium of the imagerecording unit 114 may be attached to or detached from the imagingapparatus 1 via the interface.

The control unit 115 conducts central control of operations ofrespective units of the imaging apparatus 1. More specifically, thecontrol unit 115 includes a central processing unit (CPU), a read-onlymemory (ROM), and so forth. The control unit 115 implements theabove-described central control by causing the CPU to read out programdata stored in the ROM, to load the program data onto the work area ofthe image recording unit 114, and to execute in sequence the programdata. For example, the control unit 115 controls system processing suchas a shooting sequence by the image sensor 108 according to an operationmode set by an operation unit 118 and a shooting mode switch (SW) 119.

A video RAM (VRAM) 116 temporarily stores image data output from thecontrol unit 115 for use in a display of an operation display unit 117.The operation display unit 117 is a display device, such as a liquidcrystal display (LCD) or the like, which displays an image under thecontrol of the control unit 115. The operation display unit 117 performsa display for operational support and a state display of the imagingapparatus 1, as well as displays of a shooting image plane by an EVFduring shooting process and an AF area set in advance in the shootingimage plane.

The operation unit 118 includes buttons for receiving an operationinstruction from a user and outputting an operation signal to thecontrol unit 115, and a touch panel arranged on a screen of theoperation display unit 117, and others. More specifically, the operationunit 118 includes a menu switch operable to perform various types ofsettings, e.g., a setting of a shooting function of the imagingapparatus 1 and a setting during an image reproduction, a zoom leveroperable to instruct a zooming operation of the photographic lens 101,and the operation mode changeover switch operable to switch a shootingmode and a reproduction mode. The shooting mode SW 119 is a switchoperable to receive a changeover instruction of the shooting mode of theimaging apparatus 1 from the user and to output it to the control unit115. For example, the shooting mode SW 119 receives from the user thechangeover instruction of ON or OFF of a face detection mode forperforming face detection from the captured image. Further, the shootingmode SW 119 may receive a changeover instruction of the AF mode from theuser.

A main switch 120 is a switch operable to receive a power ON/OFFinstruction from the user and to output it to the control unit 115. Afirst switch 121 is a switch operable to receive from the user a startinstruction of a shooting standby operation such as starting the AFprocessing and AE processing in advance, and to output the startinstruction to the control unit 115. A second switch 122 is a switchoperable to receive from the user the start instruction of shootingafter the operation of the first switch 121 and to output the startinstruction to the control unit 115. Alternatively, the first switch 121and the second switch 122 may be configured such that the first switch121 is turned ON by a half press of a shutter button (not illustrated),and the second switch 122 is turned ON by a full press of the shutterbutton.

A face detection module 123 detects a face region of a person fromimage-processed digital image data output from the image processing unit110, and outputs one or a plurality of pieces of face information(position of face region, its size, reliability, etc.) which have beendetected to the control unit 115. Publicly known technologies can beapplied to a method for detecting a face of a person, and it has not adirect relationship with the present invention, and thus detaileddescription will be omitted.

In addition, publicly known face detection technologies include atechnique based on a learning which utilizes a neural network, forexample, a method for searching for areas which are characteristic ofshapes of eyes, nose, mouth, etc., using a template matching from animage, and regarding it as a face if similarity is high, and others.Further, besides, a technique for detecting image feature quantity suchas color of skin and shape of eyes using a statistical analysis, and anumber of other techniques are discussed. Generally, accuracy of theface detection is enhanced by combining a plurality of these techniques.A specific example includes a method for face detection utilizing awavelet conversion and an image feature quantity, as discussed inJapanese Patent Application Laid-Open No. 2002-251380.

A moving object detection unit 124 compares a plurality of capturedimages which have been continuously captured by the image sensor 108with each other, and detects whether an object and background aremoving, and outputs information about the moving object to the controlunit 115. More specifically, the moving object detection unit 124compares two frames of the captured images which are aligned side byside in time sequence, out of image-processed digital image data outputfrom the image processing unit 110, and detects moving objectinformation (amount of movement, position, range) of the object and thebackground from the difference information, and outputs it to thecontrol unit 115.

An angular velocity sensor unit 125 detects a movement (angularvelocity) of the imaging apparatus 1 itself and outputs movementinformation (amount of movement) thereof to the control unit 115. Morespecifically, the angular velocity sensor unit 125 may be typically agravity sensor or a gyro sensor, which detects a position of spherewithin a circular cavity and detects an orientation of the imagingapparatus 1 relative to the vertical direction.

Next, an operation of the imaging apparatus 1 performed under thecontrol of the control unit 115 will be described below with referenceto FIG. 2 to FIG. 17. FIG. 2 is a flowchart illustrating an operation ofthe imaging apparatus 1. The control unit 115 stores variablesinformation for operation in the work area of the DRAM 113, in aflowchart illustrated below, and executes processing while reading outand updating the variables information in each step. The variablesinformation stored in the work area of the DRAM 113 includes flag dataand numerical data such as calculated values and counter values.

The flag data includes an in-focus flag, a peak detection flag, adistance change flag, a same direction movement flag, a face detectionflag, and others. The in-focus flag is flag data that indicates adetermined result in an in-focus determination. If the in-focus flag isTRUE, it denotes that focus is achieved on an object, and if FALSE, itindicates that focus is not achieved on the object. The face detectionflag is flag data that indicates whether a face is detected in the facedetection module 123. If the face detection flag is TRUE, it indicatesthat a face is detected, and if FALSE, it indicates that the face is notdetected. A peak detection flag is flag data that indicates that a peakwhere a focus evaluation value becomes maximal in a hill-climbing AFoperation (focus detection operation) is detected. If the peak detectionflag is TRUE, it indicates that the peak is detected, and if FALSE, itindicates that the peak is not detected. A distance change flag is flagdata that indicates that an object distance between the imagingapparatus 1 and the object is changed. If the distance change flag isTRUE, it indicates that the object distance has changed, and if FALSE,it indicates that the object distance has not changed. A same directionmovement flag is flag data that indicates whether a direction of a peakposition relative to a scan center position in a current focus detectionoperation is the same as a direction of a peak position relative to ascan center position in the previous focus detection operation. If thesame direction movement flag is TRUE, it indicates they are the samedirections, and if FALSE, it indicates that they are not the samedirections.

Further, numerical data includes a focus evaluation value describedabove, an acquisition counter, an increase counter, number of times ofdetected-face size change, number of times of luminance value change,number of times of focus evaluation value change, number of times ofcamera operation, number of times of object operation, xcount value, andStCount value. The acquisition counter is numerical data that indicatesthe number of times that the current position of the focus lens 104 hasbeen acquired. The increase counter is numerical data that indicatesthat a focus evaluation value acquired in the nearest precedingprocessing, in the hill-climbing AF, is larger than a focus evaluationvalue acquired in the preceding processing (the number of times). Thenumber of times of detected-face size change is numerical data thatindicates the number of times that a size of face detected by the facedetection module 123 in an image area of AF frame has changed. Thenumber of times of luminance value change is numerical data thatindicates the number of times that the luminance value has changed inthe image area of the AF frame. The number of times of focus evaluationvalues change is numerical data that indicates the number of times thatthe focus evaluation value has changed in the image area of the AFframe. The number of times of camera operation is numerical data thatindicates the number of times that the operation amount (amount ofmovement) of the imaging apparatus 1 has changed by an amount equal toor greater than a predetermined value set in advance. The number oftimes of object operation change is numerical data that indicates thenumber of times that an operation amount of an object has changed by anamount equal to or greater than a set in advance predetermined value.The xcount value is numerical data that indicates the number of timesthat in-focus determinations are not “∘” determinations consecutively(number of times of “x” determinations). The StCount value is numericaldata that indicates the number of times that differences between peakpositions and scan center positions become consecutively smaller than apredetermined value.

As illustrated in FIG. 2, the imaging apparatus 1 starts processingunder the control of the control unit 115 by turning the main switch 120ON so as to turn the power on. If the processing is started, then instep S201, the control unit 115 checks a remaining capacity of therecording medium in the image recording unit 114. If the remainingcapacity is 0 (YES in step S201), then the processing proceeds to stepS202. If the remaining capacity is not 0 (NO in step S201), then theprocessing proceeds to step S203. In step S201, in advance of adetection of the remaining capacity, the control unit 115 may detectwhether the recording medium exists in the image recording unit 114. Ifthe recording medium is not connected thereto, the processing mayproceed to step S201.

If the remaining capacity of the storage medium of the image recordingunit 114 is 0, the control unit 115 displays a warning that theremaining capacity of the image recording unit 114 is 0 to the operationdisplay unit 117 in step S202, and then the processing returns to stepS201. Alternatively, in step S202, the control unit 115 may output awarning sound from an audio output unit (not illustrated) constituted byan amplifier and speaker, or may perform the both of warning display bythe operation display unit 117 and an output of the warning sound by theaudio output unit.

In step S203, the control unit 115 checks whether the AF mode is set toa continuous AF mode or a single AF mode. If the AF mode is set to thecontinuous AF mode (YES in step S203), the processing proceeds to stepS204. If the AF mode is set to the single AF mode (NO in step S203), theprocessing proceeds to step S207. The above-described AF mode is set inadvance according to an instruction from a user via the shooting mode SW119. The single AF mode is an AF mode in which a focus detectionoperation is executed one time immediately before the shooting operationso that focus is achieved on an object. The continuous AF mode is an AFmode in which the focus detection operation is repeatedly executedbefore the shooting operation to achieve good focus on the object. Thecontinuous AF mode includes a servo AF mode, which is operableprioritizing the focus detection operation rather than a visual qualityof the EVF display. In other words, the continuous AF mode or the servoAF mode is an operation mode in which the adjustment of position of thefocus lens is continuously performed.

In step S204, the control unit 115 checks whether, in an instructionfrom a user via the operation unit 118, the visual quality of the EVEdisplay is prioritized or an AF tracking which repeatedly executes thefocus detection operation is prioritized. If the visual quality of theEVE display is prioritized (YES in step S204), the processing proceedsto step S205. If the AF tracking is prioritized (NO in step S204), theprocessing proceeds to step S206.

In step S205, the control unit 115 performs the continuous AF accordingto the flowchart of FIG. 3 described below, and then the processingproceeds to step S207. In step S206, the control unit 115 performs theservo AF according to the flowchart of FIG. 4 described below, and thenthe processing proceeds to step S207.

In step S207, the control unit 115 checks a state of the first switch121. If the first switch is ON (YES in step S207), the processingproceeds to step S208. If the first switch is OFF (NO in step S207), theprocessing proceeds to step S201. In step S208, the control unit 115performs the AE processing from an output of the image processing unit110 by the AE processing unit 103, and then the processing proceeds tostep S209, in step S209, the control unit 115 checks a state of thein-focus flag. If the in-focus flag is TRUE (YES in step S209), theprocessing proceeds to step S211. If the in-focus flag is FALSE (NO instep S209), the processing proceeds to step S210.

In step S210, the control unit 115 performs a normal AF operationaccording to the flowchart of FIG. 7 described below, and then theprocessing proceeds to step S211. In step S211, the control unit 115checks whether the AF mode is set to the servo AF mode. If the AF modeis set to the servo AF mode (YES in step S211), the processing proceedsto step S212. If the AF mode is not set to the servo AF mode (NO in stepS211), the processing proceeds to step 213. In step S212, the controlunit 115 performs the servo AF according to the flowchart of FIG. 4described below, and then the processing proceeds to step S213.

In step S213, the control unit 115 checks a state of the first switch121. If the first switch 121 is ON (YES in step S213), the processingproceeds to step S214. If the first switch 121 is OFF (NO in step S213),the processing proceeds to step S201. In step S214, the control unit 115checks a state of the second switch 122. If the second switch 122 is ON(YES in step S214), the processing proceeds to step S215. If the secondswitch 122 is OFF (NO in step S214), the processing proceeds to stepS211. In step S215, the control unit 115 performs a shooting operationaccording to the flowchart of FIG. 17 described below, and then theprocessing proceeds to step S201.

Through the above-described processing, in the imaging apparatus 1, theprocessing from step S201 to step S207 will be performed in a loop,until the power is turned ON and the first switch 121 is turned ON.Further, in the imaging apparatus 1, when the first switch 121 is turnedON, the processing from step S208 to step S213 will be performed, and ina state that the first switch 121 remains to be ON and the second switch122 is turned OFF, the processing from step S211 to step S213 will beperformed in a loop. Then, when the second switch 122 is turned ON, in astate that the first switch 121 is turned ON, the shooting process willbe performed.

Next, a subroutine of the continuous AF in step S205 in the flowchart ofFIG. 2 will be described below with reference to the flowchart of FIG.3. As illustrated in FIG. 3, when the continuous AF is started, then instep S301, the control unit 115 checks whether face detection isavailable in the face detection module 123. If the face detection isavailable (YES in step S301), the processing proceeds to step S302. Ifthe face detection is not available (NO in step S301), the processingproceeds to step S304.

In steep S302, the control unit 115 acquires face information such as aface position and a face size detected by the face detection module 123,and then the processing proceeds to step S303. In step S303, the controlunit 115 sets a face detection flag, which indicates that a face hasbeen detected, to TRUE, and then the processing proceeds to step S304.

In step S304, the control unit 115 checks a state of the face detectionflag. If the face detection flag is TRUE (YES in step S304), theprocessing proceeds to step S305. If the face detection flag is FALSE(NO in step S304), the processing proceeds to step S306.

In step S305, the control unit 115 sets an AF frame (focus detectionarea) to a latest face detection position detected by the face detectionmodule 123, and then the processing proceeds to step S307. In thisprocess, a size of the AF frame when a face is detected, may be set to apredetermined size set in advance in a ROM or the like, or may be set toa size corresponding to a face size detected by the face detectionmodule 123. In step S306, the control unit 115 sets the AF frame to apredetermined position set in advance such as a central area, and thenthe processing proceeds to step S307. In step S307, the control unit 115acquires a focus evaluation value (contrast value) and a luminance valuein an image area within the AF frame set in step S305 or S306, and thenthe processing proceeds to step S308.

In step S308, the control unit 115 checks a state of the peak detectionflag, which indicates that a peak has been detected in a hill-climbingAF operation in step S309 described below. If the peak detection flag isTRUE (YES in step S308), the processing proceeds to step S310. If thepeak detection flag is FALSE (NO in step S308), the processing proceedsto step S309. In step S309, the control unit 115 performs thehill-climbing AF operation according to the flowchart of FIG. 5described below. Then, a subroutine of the continuous AF ends, and thenthe processing proceeds to step S207.

In step S310, the control unit 115 determines whether an object distancehas changed, according to the flowchart of FIG. 6 described below, andthen the processing proceeds to step S311. In step S311, the controlunit 115 checks a state of the distance change flag, which indicates theobject distance has changed. If the distance change flag is TRUE (YES instep S311), the processing proceeds to step S312. If the distance changeflag is FALSE (NO in step S311), the processing proceeds to step S313.

In step S312, the control unit 115 sets the peak detection flag and thedistance change flag to FALSE. After that, the control unit 115 resets amaximum value of a focus evaluation value, a peak position, used in thesubroutine of the hill-climbing AF operation in step S309, and theincrease counter, which indicates an increase of the focus evaluationvalue, and then the processing proceeds to step S313. In step S313, thecontrol unit 115 causes the focus lens to remain stopped, and then theprocessing proceeds to step S207.

Next, a subroutine of the servo AF operation in steps S206 and S212 inthe flowchart of FIG. 2 will be described below with reference to theflowchart of FIG. 4. As illustrated in FIG. 4, when the servo AFoperation is started, the control unit 115 checks whether face detectionis available in the face detection module 123 in step S401. If the facedetection is available (YES in step S401), the processing proceeds tostep S402. If the face detection is not available (NO in step S401), theprocessing proceeds to step S404.

In step S402, the control unit 115 acquires face information such asface position/face size detected by the face detection module 123, andthen the processing proceeds to step S403. In step S403, the controlunit 115 sets the face detection flag, which indicates that the face isbeing detected, to TRUE, and then the processing proceeds to step S404.

In step S404, the control unit 115 checks a state of the face detectionflag. If the face detection flag is TRUE (YES in step S404), theprocessing proceeds to step S405. If the face detection flag is FALSE(NO in step S404), the processing proceeds to step S406.

In step S405, the control unit 115 sets the AF frame to a latest facedetection position detected by the face detection module 123, and thenthe processing proceeds to step S407. Alternatively, the control unit115 may set a size of the AF frame when the face is being detected to apredetermined size set in advance, or may set it to a size correspondingto a detected-face size. In step S406, the control unit 115 sets the AFframe to a predetermined position set in advance such as a central area,and then the processing proceeds to step S407. In step S407, the controlunit 115 acquires a focus evaluation value and a luminance value in animage area within the AF frame, which has been set in step S405 or S406,and then the processing proceeds to step S408.

In step S408, the control unit 115 checks a state of the peak detectionflag, which indicates that a peak is detected in the hill-climbing AFoperation of S409 described below. If the peak detection flag is TRUE(YES in step S408), the processing proceeds to step S410. If the peakdetection flag is FALSE (NO in step S408), the processing proceeds tostep S409. In step S409, the control unit 115 performs the hill-climbingAF operation according to the flowchart of FIG. 5 described below. Then,a subroutine of the servo AF operation ends. Then, the processingproceeds to step S207 or S213.

In step S410, the control unit 115 checks a state of the distance changeflag, which indicates that the object distance has changed. If thedistance change flag is TRUE (YES in step S410), the processing proceedsto step S412. If the distance change flag is FALSE (NO in step S410),the processing proceeds to step S411. In step S411, the control unit 15checks whether the in-focus flag is TRUE. If the in-focus flag is TRUE(YES in step S411), the processing proceeds to step S413. If thein-focus flag is FALSE (NO in step S411), the processing proceeds tostep S412.

In step S412, the control unit 115 performs a continuous servo AFoperation according to the flowchart of FIG. 8 described below. Then,the subroutine of the servo AF operation ends. Then, the processingproceeds to step S207 or S213. In step S413, the control unit 115determines whether the object distance has changed according to theflowchart of FIG. 6 described below. Then, a subroutine of the servo AFoperation ends. Then, the processing proceeds to step S207 or S213.

Next, a subroutine of the hill-climbing AF operation in step S309 in theflowchart of FIG. 3 and step S409 in the flowchart of FIG. 4 will bedescribed below with reference to the flowchart of FIG. 5. Asillustrated in FIG. 5, when the hill-climbing AF operation is started,in step S501, the control unit 115 acquires a current position of thefocus lens 104, and then the processing proceeds to step S502.

In step S502, the control unit 115 acquires a focus evaluation value anda luminance value in the image area within the AF frame which has beenset, and increments the acquisition counter for counting acquisitions ofcurrent positions of the focus lens 104, and then the processingproceeds to step S503. The acquisition counter is assumed to be set inadvance to 0 (or NULL value) in an initialization operation (notillustrated).

In step S503, the control unit 115 checks whether the value of theacquisition counter is 1. If the value of the acquisition counter is 1(YES in step S503), the processing proceeds to step S506. If the valueof the acquisition counter is not 1 (NO in step S503), the processingproceeds to step S504.

In step S504, the control unit 115 checks whether a “current focusevaluation value” acquired in nearest preceding processing is greaterthan a “previous focus evaluation value” acquired in the precedingprocessing. If the “current focus evaluation value” is greater than the“previous focus evaluation value” (YES in step S504), the processingproceeds to step S505. If the “current focus evaluation value” is equalto or smaller than the “previous focus evaluation value” (NO in stepS504), the processing proceeds to step S512.

In step S505, the control unit 115 increments by 1 the increase counter,which indicates the “current focus evaluation value” is greater than the“previous focus evaluation value”, and then the processing proceeds tostep S505. The increase counter is assumed to be set in advance to 0 (orNULL value) in the initialization operation described above.

In step S506, the control unit 115 stores the current focus evaluationvalue in an arithmetic memory (not illustrated) incorporated in thecontrol unit 115 as a maximum value (peak evaluation value) of focusevaluation values, and then the processing proceeds to step S507. Instep S507, the control unit 115 stores a current position of the focuslens 104 in the arithmetic memory incorporated in the control unit 115as a peak position of the focus evaluation value, and then theprocessing proceeds to step S508. In step S508, the control unit 115stores a current focus evaluation value in the arithmetic memoryincorporated in the control unit 115 as the previous focus evaluationvalue, and then the processing proceeds to step S509.

In step S509, the control unit 115 checks whether the current positionof the focus lens 104 is at an end of a movement range set in advance.If the focus lens is located at the end of the movement range (YES instep S509), the processing proceeds to step S510. If the focus lens isnot located at the end of the movement range (NO in step S509), theprocessing proceeds to step S511. Note that the movement range isrepresentative of the movement range of the focus lens 104 set byprocessing described below, and a movable range of the focus lens 104 isassumed to have been set in advance in a standard state. A scanningoperation such as the hill-climbing AF operation is performed by movingthe focus lens 104 within the movement range previously set.

In step S510, the control unit 115 reverses a moving direction of thefocus lens 104, and then the processing proceeds to step S511. In stepS511, the control unit 115 moves the focus lens 104 by a predeterminedamount set in advance. Then, a subroutine of the hill-climbing AFoperation ends.

In step S512, the control unit 115 reads out a peak evaluation valuestored in the arithmetic memory, and checks whether “peak evaluationvalue−current focus evaluation value” is greater than a predeterminedamount set in advance (threshold value). If the difference is greaterthan the predetermined amount (YES in step S512), the processingproceeds to step S513. If the difference is equal to or less than thepredetermined amount (NO in step S512), the processing proceeds to stepS508. In this process, if the “peak evaluation value−current focusevaluation value” is greater than the predetermined amount, and thecurrent focus evaluation value is decreased by the predetermined amountfrom the peak evaluation value, the peak evaluation value is regarded asa focus evaluation value when focusing on the object. In other words,the focus lens 104 is moved within the movement range, and an inflectionpoint where the focus evaluation value turns from an increase to adecrease is regarded as a focus evaluation value when focusing on theobject.

In step S513, the control unit 115 checks whether the increase counteris greater than 0. If the increase counter is greater than 0 (YES instep S513), the processing proceeds to step S514. If the increasecounter is equal to or smaller than 0 (NO in step S513), the processingproceeds to step S508.

In step S514, the control unit 115 moves the focus lens 104 to a peakposition where a focus evaluation value stored in S507 becomes a maximumvalue, and then the processing proceeds to step S515. In step S515, thecontrol unit 11 sets the peak detection flag to TRUE, and then theprocessing proceeds to step S516. In step S516, the control unit 115sets the acquisition counter to 0, and then the processing proceeds tostep S207.

Next, a subroutine of determining whether object distance has changed instep S310 in the flowchart of FIG. 3 and step S413 in the flowchart ofFIG. 4 will be described below with reference to the flowchart of FIG.6. As illustrated in FIG. 6, when a subroutine of determining whetherthe object distance has changed is started, the control unit 115 checkswhether a face detection is available in the face detection module 123in step S601. If the face detection is available (YES in step S601), theprocessing proceeds to step S602. If the face detection is not available(NO in step S601), the processing proceeds to step S606.

In step S602, the control unit 115 checks whether a size of facedetected in a current processing has changed by a predeterminedpercentage set in advance or more with respect to a size of facedetected in a previous processing. In other words, in step S602, in theoperation mode in which the adjustment of a position of the focus lensis continuously performed, the control unit 115 detects presence orabsence of change in a distance from the object depending on whether asize of face region of a person continuously acquired has changed by apredetermined percentage or more. If the size of detected face haschanged by the predetermined percentage or more (YES in step S602), theprocessing proceeds to step S603. If the size of detected-face has notchanged by the predetermined percentage or more (NO in step S602), theprocessing proceeds to step S606. In step S603, the control unit 115increments the number of times of detected-face size change, and thenthe processing proceeds to step S604. In step S604, the control unit 115checks whether the number of times of face size change is equal to orgreater than a threshold value set in advance. If the number of times offace size change is equal to or greater than the threshold value (YES instep S604), the processing proceeds to step S605. If the number of timesof face size change is less than the threshold value (NO in step S604),the processing proceeds to step S606. In step S605, the control unit 115sets the in-focus flag to FALSE and sets the distance change flag toTRUE. Then, a subroutine of determining whether the object distance haschanged ends.

In step S606, the control unit 115 checks whether a luminance valueacquired in the current processing has changed by a predetermined valueset in advance or more with respect to a luminance value acquired in theprevious processing. In other words, in step S606, the presence orabsence of change in a distance from the object is detected, dependingon whether a change amount of continuously acquired luminance values haschanged by the predetermined value or more, in the operation mode inwhich the adjustment of position of the focus lens is continuouslyperformed. If the luminance value has changed by the predetermined valueor more (YES in step S606), the processing proceeds to step S607. If theluminance value has not changed by the predetermined value or more (NOin step S606), the processing proceeds to step S609. In step S607, thecontrol unit 115 increments the number of times of luminance valuechange, and then the processing proceeds to step S608. In step S608, thecontrol unit 115 checks whether the number of times of the luminancevalue change is equal to or greater than a threshold value set inadvance. If the number of times is equal to or greater than thethreshold value (YES in step S608), the processing proceeds to stepS605. If the number of times is less than the threshold value (NO instep S608), the processing proceeds to step S609.

In step S609, the control unit 115 checks whether a focus evaluationvalue acquired in the current processing has changed by a predeterminedvalue set in advance or more, with respect to a focus evaluation valueacquired in the previous processing. In other words, in step S609, thepresence or absence of change in a distance from the object is detecteddepending on whether a change amount of the focus evaluation valuecontinuously acquired, in the operation mode in which the adjustment ofa position of the focus lens is continuously performed, has changed bythe predetermined value or more. If the focus evaluation value haschanged by the predetermined value or more (YES in step S609), theprocessing proceeds to step S610. If the focus evaluation value has notchanged by the predetermined value or more (NO in step S609), theprocessing proceeds to step S612. In step S610, the control unit 115increments the number of times of focus evaluation value change, andthen the processing proceeds to step S611. In step S611, the controlunit 115 checks whether the number of times of focus evaluation valuechange is equal to or greater than a threshold value set in advance. Ifthe number of times is equal to or greater than the threshold value (YESin step S611), the processing proceeds to step S605. If the number oftimes is not equal to or greater than the threshold value (NO in stepS611), the processing proceeds to step S612.

The control unit 115 checks whether a camera operation amount of theimaging apparatus 1 detected by the angular velocity sensor unit 125 haschanged by a predetermined value set in advance or more. In other words,in step S612, the presence or absence of change in distance from theobject is detected according to an operation amount of the imagingapparatus 1, in the operation mode in which the adjustment of a positionof the focus lens is continuously performed. If the camera operationamount has changed by the predetermined value or more (YES in stepS612), the processing proceeds to step S613. If the camera operationamount has not changed by the predetermined value or more (NO in stepS612), the processing proceeds to step S615. In step S613, the controlunit 115 increments the number of times of the camera operation, andthen the processing proceeds to step S614. In step S614, the controlunit 115 checks whether the number of times of the camera operation isequal to or greater than a threshold value set in advance. If the numberof times is equal to or greater than the threshold value (YES in stepS614), the processing proceeds to step S605. If the number of times isless than the threshold value (NO in step S614), the processing proceedsto step S615.

In step S615, the control unit 115 checks whether an operation amount ofan object detected by the moving object detection unit 124 is equal toor greater than a predetermined value set in advance. In other words, instep S615, the presence or absence of change in a distance from theobject is detected according to an operation amount of the object, inthe operation mode in which the adjustment of a position of the focuslens is continuously performed. If the operation amount of the object isequal to or greater than the predetermined value (YES in step S615), theprocessing proceeds to step S616. If the operation amount of the objectis not equal to or greater than the predetermined value (NO in stepS615), the processing proceeds to step S618. In step S616, the controlunit 115 increments the number of times of the object operation, andthen the processing proceeds to step S617. In step S617, the controlunit 115 checks whether the number of times of the object operation isequal to or greater than a threshold value set in advance. If the numberof times is equal to or greater than the threshold value (YES in stepS617), the processing proceeds to step S605. If the number of times isless than the threshold value (NO in step S617), the processing proceedsto step S618.

In step S618, the control unit 115 checks whether any evaluation valueof a face detection size/a luminance value/a focus evaluation value isin an unchanged state, and a camera operation amount and an objectoperation amount are not equal to or greater than a predetermined value.If any evaluation value is in an unchanged state, and any operationamount is not equal to or greater than the predetermined value (YES instep S618), the processing proceeds to step S619. Further, if anyevaluation value is in a changed state, or, any operation amount isequal to or greater than the predetermined value (NO in step S618), thenthe subroutine of determining whether the object distance has changedends. In step S619, the control unit 115 sets all of the number of timesof face size change/the number of times of luminance value change/thenumber of times of focus evaluation value change, the number of times ofcamera operation, and the number of times of object operation to 0 (orNULL value). Then, the subroutine of determining whether the objectdistance has changed ends.

As described above, the control unit 115 performs the subroutine ofdetermining whether the object distance has changed, which detects thepresence or absence of a change in the distance between the object andthe imaging apparatus 1, even in the continuous AF mode or the servo AFmode. Consequently, in the imaging apparatus 1, the movement of thefocus lens can be controlled according to the distance change flag,which represents a detection result that the presence or absence ofchange in the distance between the object and the imaging apparatus 1has been detected, in the operation mode in which the adjustment of aposition of the focus lens is continuously performed. For example, whena distance between the object and the imaging apparatus 1 has changed,the movement of the focus lens, which has been stopped, can be resumedby setting the distance change flag to TRUE.

Next, a subroutine of the normal AF operation in S210 in the flowchartof FIG. 2 will be described below with reference to the flowchart ofFIG. 7. As illustrated in FIG. 7, when the normal AF operation isstarted, then the control unit 115 checks whether a face detection isavailable in the face detection module 123 in step S701. If the facedetection is available (YES in step S701), the processing proceeds tostep S702. If the face detection is not available (NO in step S701), theprocessing proceeds to step S704.

In step S702, the control unit 115 acquires face information such asface position/face size detected by the face detection module 123, andthen the processing proceeds to step S703. In step S703, the controlunit 115 sets the face detection flag, which indicates that the facedetection is available, to TRUE, and then the processing proceeds tostep S704.

In step S704, the control unit 115 checks a state of the face detectionflag. If the face detection flag is TRUE (YES in step S704), theprocessing proceeds to step S705. If the face detection flag is FALSE(NO in step S704), the processing proceeds to step S706.

In step S705, the control unit 115 sets the AF frame to a latest facedetection position, and then the processing proceeds to step S707.Alternatively, a size of the AF frame when the face is being detectedmay be set to a predetermined size set in advance, or may be set to asize corresponding to the detected face size. In step S706, the controlunit 115 sets the AF frame to a predetermined position set in advancesuch as a central area, and then the processing proceeds to step S707.

In step S707, the control unit 115 checks whether the AF mode set by theshooting mode SW 119 is the continuous AF, or, the single AF mode. Ifthe AF mode is set to the continuous AF mode (YES in step S707), theprocessing proceeds to step S708. If the AF mode is set to the single AFmode (NO in step S707), the processing proceeds to step S710.

In step S708, the control unit 115 checks whether the peak detectionflag is TRUE. If the peak detection flag is TRUE (YES in step S708), theprocessing proceeds to step S711. If the peak detection flag is FALSE(NO in step S708), the processing proceeds to step S710. In step S710,the control unit 115 sets a movement range to the whole range (firstrange) of a movable range of the focus lens 104, and then the processingproceeds to step S712. In step S711, the control unit 115 sets apredetermined range set in advance (second range) centering on a currentposition of the focus lens 104 as a movement range, and then theprocessing proceeds to step S712.

In step S711, since a peak evaluation value at which an object is atfocus has been detected, a second range, narrowed down to narrower thanthe first range, is set as a movement range centering on a lens positionof the focus lens 104 where the peak evaluation value is attained.Therefore, in the imaging apparatus 1, a focus detection operation inthe normal AF operation can be efficiently performed by the setting ofthe movement range in step S711.

In step S712, the control unit 115 performs the focus detectionoperation according to the flowchart of FIG. 12 described below, andthen the processing proceeds to step S713. In step S713, the controlunit 115 performs the in-focus determination according to the flowchartof FIG. 13 described below, and then the processing proceeds to stepS714.

In step S714, the control unit 115 checks whether a result of thein-focus determination in step S713 (the details will be describedbelow) is determined as “∘”. If it is determined as “∘” (YES in stepS714), the processing proceeds to step S715. If it is determined as “x”(NO in step S714), the processing proceeds to step S717.

In step S715, the control unit 115 moves the focus lens 104 to a peakposition calculated in the scanning in step S712, and then theprocessing proceeds to step S716. In step S716, the control unit 115sets the peak detection flag and the in-focus flag to TRUE, and sets thedistance change flag to FALSE. Then, the subroutine of the normal AFoperation ends.

In step S717, the control unit 115 moves the focus lens 104 to aposition set in advance (fixed point), and then the processing proceedsto step S718. In the process, the fixed point is set to a distance whereprobability that an object exists is high. If a face has been detected,the fixed point may be set to a calculated distance by estimating adistance of a person from a face size. In step S718, control unit 115sets the peak detection flag and the distance change flag to FALSE.Then, the subroutine of the normal AF operation ends.

Next, a subroutine of the continuous servo AF operation in step S412 inthe flowchart of FIG. 4 will be described below with reference to theflowchart of FIG. 8. As illustrated in FIG. 8, in step S801, the controlunit 115 acquires a current time from a real time clock (RTC) unit (notillustrated), and calculates a time taken for a next scan (scan in stepS810 described below). Next, the control unit 115 calculates a time(predicted time) when a position of the focus lens 104 is located at acenter of the movement range, in the next scan, to determine PreTime,and then the processing proceeds to step S802. In step S802, the controlunit 115 performs predictability determination according to theflowchart of FIG. 9 described below, and then the processing proceeds tostep S803.

In step S803, the control unit 115 checks whether a result of thepredictability determination in the predictability determination in stepS802 is predictable. If the result is predictable (YES in step S803),the processing proceeds to step S804. If the result is not predictable(NO in step S803), the processing proceeds to step S805.

In step S804, the control unit 115 predicts an object position accordingto the flowchart of FIG. 10 described below, and then the processingproceeds to step S807. In step S805, the control unit 115 clearsprevious data for prediction of a moving object as will be describedbelow, i.e, ScanTime [0] to ScanTime [i−1] and HokanPeak [0] toHokanPeak [i−1]. Furthermore, the control unit 115 sets a variable i to0, and then the processing proceeds to step S806. The variable iindicates the number of times that it has been consecutively determinedto be predictable. In step S806, the control unit 115 sets a currentposition of the focus lens 104 to a scan center position, and then theprocessing proceeds to step S807.

In step S807, the control unit 115 checks whether the in-focus flag isTRUE. If the in-focus flag is TRUE (YES in step S807), the processingproceeds to step S808. If the in-focus flag is FALSE (NO in step S807),the processing proceeds to step S809. In step S808, the control unit 115sets a movement range to a predetermined range set in advance (thirdrange), and then the processing proceeds to step S810. In step S809, thecontrol unit 115 sets the movement range to a range (fourth range) widerthan the third range previously set in step S808, the processingproceeds to step S810. In step S809, it is apparent from the in-focusflag that a peak evaluation value at which an object is at the focus isnot detected. Consequently, a scanning operation is performed by settingthe movement range to the fourth range wider than the third range,causing focusing to the object to be unerringly performed.

In step S810, the control unit 115 performs scanning according to theflowchart of FIG. 12 described below, and then the processing proceedsto step S811. In step S811, the control unit 115 performs the in-focusdetermination according to the flowchart of FIG. 13 described below, andthen the processing proceeds to step S812.

In step S812, the control unit 115 checks whether a result of thein-focus determination performed in step Sell is determined as “∘”. Ifthe result is determined as “∘” (YES in step S812), the processingproceeds to step S813. If the result is determined as “x” (NO in stepS812), the processing proceeds to step S825.

In step S813, the control unit 115 sets the in-focus flag to TRUE, andthen the processing proceeds to step S814. In step S814, the controlunit 115 sets xcount to 0, and then the processing proceeds to stepS815. The xcount indicates the number of times that the in-focusdetermination has not consecutively been determined as “∘” (the numberof times that it has been determined as “x”).

In step S815, the control unit 115 checks whether a difference between ascan result (peak position) in step S810 and a scan center position issmaller than a predetermined value set in advance. If the difference issmaller than the predetermined value (YES in step S815), the processingproceeds to step S816. If the difference is not smaller than thepredetermined value (NO in step S815), the processing proceeds to stepS819.

In step S816, the control unit 115 increments StCount that indicates thenumber of times a difference between the peak position in step S810 andthe scan center position has been consecutively smaller than apredetermined value, and then the processing proceeds to step S817. Instep S817, the control unit 115 checks whether the StCount is equal toor greater than a threshold value set in advance. If the StCount isequal to or greater than the threshold value (YES in step S817), theprocessing proceeds to step S818. If the StCount is less than thethreshold value (NO in step S817), the processing proceeds to step S820.In other words, the control unit 115 determines whether a focus lensposition at which a focus evaluation value becomes maximal is includedwithin a range set in advance, relative to a reference position (scancenter position) determined based on an adjustment result of the focuslens 104 by the continuous servo AF operation. Then, the control unit115 determines whether a state that the focus lens position at which thefocus evaluation value becomes maximal is included within the range setin advance, is repeated by the number of times set in advance, anddetects the presence or absence of a distance change.

In step S818, the control unit 115, upon determining that the distancechange of the object has stopped, sets the distance change flag toFALSE. In step S818 a, the control unit 115 stops a movement of thefocus lens 104. Then, the subroutine of the continuous servo AFoperation ends. Consequently, in the imaging apparatus 1, if the objectdistance does not change even in the servo AF, stopping the focus lenscan prevent a scan in the servo AF from being uselessly repeated.

In step S819, the control unit 115 clears the StCount to 0, and then theprocessing proceeds to step S820. In step S820, the control unit 115checks whether a direction of a current peak position relative to acurrent scan center position in step S810 is the same as that of aprevious peak position relative to a previous scan center position. Ifthe both directions are the same (YES in step S820), the processingproceeds to step S821. If the both directions are not the same (NO instep S820), the processing proceeds to step S822.

In step S821, the control unit 115 sets the same direction movement flagto TRUE, and then the processing proceeds to step S823. In step S822,the control unit 115 sets the same direction movement flag to FALSE, andthen the processing proceeds to step S823.

In step S823, the control unit 115 assumes a time when the position ofthe focus lens 104 in the current scan is located at a center of amovement range to be ScanTime [i], and a peak position in the currentscan to be HokanPeak [i], and then the processing proceeds to step S824.In step S824, the control unit 115 increments i. Then, the subroutine ofthe continuous servo AF operation ends.

In step S825, the control unit 115 sets the in-focus flag to FALSE, andthen the processing proceeds to step S826. In step S826, the controlunit 115 increments the xCount, and then the processing proceeds to stepS827.

In step S827, the control unit 115 checks whether the xCount is greaterthan a predetermined value set in advance. If the xCount is greater thanthe predetermined value (YES in step S827), the processing proceeds tostep S828. If the xCount is not greater than the predetermined value (NOin step S827), then the subroutine of the continuous servo AF operationends. In step S828, the control unit 115 sets the peak detection flagand the distance change flag to FALSE. Then, the subroutine of thecontinuous servo AF operation ends.

Next, a subroutine of the predictability determination in step S802 inthe flowchart of FIG. 8 will be described below with reference to theflowchart of FIG. 9. As illustrated in FIG. 9, in step S901, the controlunit 115 checks whether i=0 for variables i in the continuous servo AFoperation. If i is 0 (YES in step S901), the processing proceeds to stepS905. If i is not 0 (NO in step S901), the processing proceeds to stepS902.

In step S902, the control unit 115 checks whether a difference between.PreTime and ScanTime [i−1] is shorter than a predetermined time set inadvance. If the difference is shorter than the predetermined time (YESin step S902), the processing proceeds to step S903. If the differenceis longer than the predetermined time (NO in step S902), the processingproceeds to step S905. From this, a time elapsed since a previous scanuntil a current scan is found, and it is possible to determine whether aprediction using a result of the previous scan is reliable. For example,if it takes a time longer than the predetermined time, it can beconcluded that the prediction is not reliable.

In step S903, the control unit 115 checks whether the same directionmovement flag is TRUE. If the same direction movement flag is TRUE (YESin step S903), the processing proceeds to step S904. If the samedirection movement flag is FALSE (NO in step S903), the processingproceeds to step S905. Consequently, only when it is determined that anobject is moving in the same direction in terms of distance direction,it is assumed that the prediction is reliable. Thereby, an erroneousprediction due to using an erroneous AF result can be reduced.

In step S904, the control unit. 115 determines a result ofpredictability determination to be predictable. Then, the subroutine ofthe predictability determination ends. Then, the processing proceeds tostep S803. In step S905, the control unit 115 determines a result of thepredictability determination to be unpredictable. Then, the subroutineof the predictability determination ends. Then, the processing proceedsto step S803.

Next, a subroutine of predicting the object position in step S804 in theflowchart of FIG. 8 will be described below with reference to theflowchart of FIG. 10 and the explanatory views of FIGS. 11A and 11B. Asillustrated in FIG. 10, in step S1001, the control unit 115 checkswhether i is smaller than 2 for variables i in the continuous servo AFoperation. If i is smaller than 2 (YES in step S1001), the processingproceeds to step S1002. If i is equal to or greater than 2 (NO in stepS1001), the processing proceeds to step S1003. In step S1002, thecontrol unit 115 sets a scan center position to a peak position of aprevious scan. Then, the subroutine of predicting the object positionends. Then, the processing proceeds to step S807.

In step S1003, the control unit 115 checks whether i is equal to 2. Inother words, in step S1003, the control unit 115 checks whether data forpredicting the moving object is two points, to determine the case of twopoints, and the case of three points or more. If i is equal to 2 (YES instep S1003), the processing proceeds to step S1004. if i is greater than2 (NO in step S1003), the processing proceeds to step S1006.

In step S1004, the control unit 115 calculates a prediction position ofan object from data for the moving object prediction for two points, asillustrated in FIG. 11A, using a first moving object prediction formulae(1) given below, and then the processing proceeds to step S1005. Morespecifically, the control unit 115 calculates a predicted position ofthe object at PreTime, i.e., PrePosition from two points of(ScanTime[0], HokanPeak[0]), and (ScanTime[1], HokanPeak[1]).

PrePosition=(PreTime−ScanTime[0])×(HokanPeak[1]−HokanPeak[0])/(ScanTime[1]−ScanTime[0])+HokanPeak[0]  (1)

In step S1005, the control unit 115 sets the predicted position, of theobject, i.e., PrePosition calculated in step S1004 to the scan centerposition. Then, the subroutine of predicting the object position ends.Then, the processing proceeds to step S807.

In step S1006, the control unit 115 calculates a predicted position ofan object from data for predicting the moving object for three points,as illustrated in FIG. 11B, using a second moving object predictionformulae (2) given below, and then the processing proceeds to stepS1007. The data for predicting the moving object for three points are(ScanTime[i−2],HokanPeak[i−2]), (ScanTime[i−1],HokanPeak[i−1]), and(ScanTime[i],HokanPeak[i]). Therefore, the control unit 115 calculates apredicted position, i.e., PrePosition of the object at PreTime from theabove-described three points.

PrePosition=(t3/t2)×{(t3−t2)×(t2×Pos1−t1×Pos2)/t1/(t1−t2)+Pos2}+HokanPeak[i−2]  (2)

where,t1=ScanTime [i−1]−ScanTime [i−2]t2=ScanTime[i]−ScanTime[i−2]t3=PreTime−ScanTime[i−2]

Pos1=HokanPeak[i−1]−HokanPeak[i−2] Pos2=HokanPeak[i]−HokanPeak[i−2].

In step S1007, the control unit 115 sets a predicted position of theobject, i.e., PrePosition calculated in step S1006 to a scan centerposition. Then, the subroutine of predicting the object position ends.Then, the processing proceeds to step S807.

Next, a subroutine of scanning in step S712 in the flowchart of FIG. 7and step S810 of the flowchart of FIG. 8 will be described below withreference to the flowchart of FIG. 12. As illustrated in FIG. 12, instep S1201, the control unit 15 moves the focus lens 104 to ascan-starting position. In this process, the scan-starting position isset at one end of the movement range previously set.

In step S1202, the control unit 115 stores a focus evaluation value ofan image area according to an AF frame within a shooting screen and aposition of the focus lens 104 in an arithmetic memory contained withinthe control unit 115, and then the processing proceeds to step S1203.

In step S1203, the control unit 115 checks whether a lens position ofthe focus lens 104 is located at a scan end position. If the lensposition is located at the scan end position (YES in step S1203), theprocessing proceeds to step S1205. If the lens position is not locatedat the scan end position (NO in step S1203), the processing proceeds tostep S1204. The scan end position is set to the other end of themovement range, which is an opposite side to one end of the movementrange, as the scan-starting position.

In step S1204, the control unit 115 moves the focus lens 104 by apredetermined amount to a predetermined direction set in advance, andthen the processing proceeds to step S1202. In step S1205, the controlunit 115 reads out in sequence a focus evaluation value and a lensposition thereof stored in the arithmetic memory in step S1202, tocalculate a peak position of the focus evaluation value. Then, thesubroutine of scanning ends.

Next, a subroutine of the in-focus determination in step S713 in theflowchart of FIG. 7 and step Sell in the flowchart of FIG. 8 will bedescribed below with reference to FIG. 13 to FIG. 16.

When a graph has a focus lens position at the abscissa axis and a focusevaluation value at the ordinate axis, it has a hill shape asillustrated in FIG. 13, except for special cases, such as a conflictbetween far and near objects. Therefore, the imaging apparatus 1 canperform the in-focus determination by determining whether a focusevaluation value has a hill shape based on a difference between amaximum value and a minimum value of the focus evaluation value, alength of a part inclining with an inclination equal to or greater thana constant value (Slope Thr), and the slope of the inclining part. Theresult of the in-focus determination is output with the marks “∘” and“x” given as follows:

Determined as “∘”: Focus adjustment of an object is possible based on apeak position of the focus evaluation value. Determined as “x” Contrastof an object is insufficient, or an object is located at a distanceoutside distance range where scanned.

As illustrated in FIG. 13, points up to which inclination is continuedfrom a hill top (point A) are denoted as point D and point E, a widthbetween point D and point E is denoted as a width L of the hill, adifference between focus evaluation values at point A and point D isdenoted as SL1, and a difference between focus evaluation values atpoint A and point E is denoted as SL2, and the sum of SL1+SL2 is denotedas SL.

FIG. 14 is a flowchart illustrating a subroutine of the in-focusdetermination. As illustrated in FIG. 14, in step S1301, the controlunit 115 determines a maximum value and a minimum value of focusevaluation values, and, a scan point io corresponding to the maximumvalue from a result of scanning described above. Then, the processingproceeds to step S1302.

Next, in step S1302, the control unit 115 initializes variables L and SLto 0, where L represents a width of the hill of a focus evaluationvalue, and SL represents a slope of the hill, and then the processingproceeds to step S1303. In step the control unit 115 checks whether ascan point io corresponding to the maximum value in a movement rangewhere a scanning operation has been performed, is a farthest endposition. If the scan point is not located at the farthest end position(NO in step S1303), the processing proceeds to step S1304. In stepS1304, the control unit 115 checks a monotonic decrease in the infinitedistance end direction. If the scan point is located at the farthest endposition (YES in step S1303), the processing skips step S1304 and thenproceeds to step S1305.

Now, a processing for checking a monotonic decrease in the infinitedistance end direction in step S1304 will be described below. Asillustrated in FIG. 15, first in step S1401, the control unit 115initializes a counter variable i to io. Then, the processing proceeds tostep S1402.

In step S1402, the control unit 115 compares a difference between avalue d[i] of a focus evaluation value in a scan point i and a valued[i−1] of a focus evaluation value in a scan point i−1 with apredetermined value Slope Thr set in advance. The scan point i−1 isnearer to the infinite distance end side by one scan point than the scanpoint i. If the relation is d[i]−d[i−1]>=Slope Thr (YES in step S1402),the control unit 115 determines that a monotonic decrease in theinfinite distance end direction occurs. Then, the processing proceeds tostep S1403. On the other hand, if the relation is not d[i]−d[i−1]>=SlopeThr (NO in step S1402), the control unit 115 determines that a monotonicdecrease in the infinite distance end direction does not occur. Then,the processing for checking a monotonic decrease in the infinitedistance end direction ends. Then, the processing proceeds to stepS1305.

The processing for checking a monotonic decrease in the infinitedistance end direction may be continued. In such a case, the processingproceeds to step S1403. In step S1403, the control unit 115 updates avariable L representing the length of a part (a width of hill) where thefocus evaluation value inclines with an inclination equal to or greaterthan a specified value, and a variable SL representing an amount ofdecrease in a monotonic decrease section according to the followingformulae. Then, the processing proceeds to step S1404.

L=L+1

SL=SL+(d[i]−d[i−1]

In step S1404, the control unit 115 decrements the counter variable i asi=i−1 to shift a point to be detected by one scan point towards theinfinite distance end side. Then, the processing proceeds to step S1405.In step S1405, the control unit 115 checks whether the counter variablei has become a value at the farthest end position (=0) in a scannedpredetermined movement range. If the value of the counter variable i is0, that is, the start point to detect a monotonic decrease reaches thefarthest end position in the scanned predetermined movement range (YESin step S1405), the processing for checking a monotonic decrease in theinfinite distance end direction ends. Then, the processing proceeds tostep S1305. In a manner described above, the imaging apparatus 1 checksa monotonic decrease of a focus evaluation value in the infinitedistance end direction from i=io.

Referring back to FIG. 14, a continued subroutine of the in-focusdetermination will be described below. In step S1305, the control unit115 checks whether a scan point io corresponding to a maximum value isthe position of the closest distance end in a scanned predeterminedmovement range. If the scan point io is not the closest distance endposition (NO in step S1305), the processing proceeds to step S1306. Instep S1306, the control unit 115 checks a monotonic decrease in theclosest distance end direction. If the scan point io is the closestdistance end position (YES in step S1305), the processing skips stepS1306 and then proceeds to step S1307.

Now, processing for checking a monotonic decrease in the closestdistance end direction in step S1306 will be described below. Asillustrated in FIG. 16, first in step S1501, the control unit 115initializes a counter variable i to io, and then the processing proceedsto step S1502.

In step S1502, the control unit 115 compares a difference between avalue d[i] of a focus evaluation value in a scan point i and a d[i+1] ofa focus evaluation value in a scan point i+1 with a predetermined valueSlope Thr. The scan point i+1 is nearer to the closest distance end sideby one scan point than the scan point i. If the relation isd[i]−d[i+1]>=Slope Thr, (YES in step S1502), the control unit 115determines that a monotonic decrease in the closest distance enddirection occurs. Then, the processing proceeds to step S1503. On theother hand, if the relation is not d[i]−d[i+1]>=Slope Thr (NO in stepS1502), the control unit 115 determines that a monotonic decrease in theclosest distance end direction does not occur. Then, the processing forchecking a monotonic decrease in the closest distance end directionends. Then, the processing proceeds to step S1307.

The processing for checking a monotonic decrease in the closest distanceend direction may be continued. In such a case, the processing proceedsto step S1503. In step S1503, the control unit 115 updates the variableL representing the length of a part (a width of hill) where the focusevaluation value inclines with an inclination equal to or greater than aconstant value, and the variable SL representing an amount of a decreasein a monotonic decrease section according to the following formulae:Then, the processing proceeds to step S1504.

=L+1

SL=SL+(d[i]−d[i+])

In step S1504, the control unit 115 increments the counter variable i asi=i+1 to shift a point to be detected by one scan point towards theclosest distance end side. Then, the processing proceeds to step S1505.In step S1505, the control unit 115 checks whether the counter variablei has become a value (=N) at the closest distance end position in ascanned predetermined movement range. If the value of the countervariable i reaches N, that is, the start point to detect a monotonicdecrease reaches the closest distance end position in the scannedpredetermined movement range (YES in step S1505), the processing forchecking a monotonic decrease in the closest distance end directionends. Then, the processing proceeds to step S1307. As described above,the imaging apparatus 1 checks a monotonic decrease of focus evaluationvalue in the closest distance end direction from i=io.

Referring back to FIG. 14, a continued subroutine of the in-focusdetermination will be described below. When the above-describedprocessing for checking a monotonic decrease in the infinite distanceend direction and the closest distance end direction ends, the controlunit 115 compares various coefficients with respective threshold valuesto check whether the calculated focus evaluation value has a hill shape,thus determining as “∘” or “x” More specifically, the control unit 115determines as “∘” or “x” by the processing in steps S1307 to S1309described below.

In step S1307, the control unit 115 checks whether the scan point iocorresponding to a maximum value of focus evaluation values is theclosest distance end in a scanned predetermined movement range. If thescan point io is the closest distance end, the control unit 115 checkswhether a difference between the value d[n] of a focus evaluation valuein a scan point n of the closest distance end and a value d[n−1] of afocus evaluation value in a scan point n−1 is equal to or greater thanthe predetermined value Slope Thr. The scan point n−1 is nearer to theinfinite distance end side by one scan point than the scan point n. Ifthe scan point io is the closest distance end, and the difference isequal to or greater than the predetermined value Slope Thr (YES in slope1307), the processing proceeds to step S1311. If not both of theseconditions are satisfied (NO in slope 1307), the processing proceeds tostep S1308.

In step S1308, the control unit 115 checks whether the scan point iocorresponding to the maximum value of focus evaluation values is thefarthest end in a scanned predetermined movement range. If the scanpoint io is the farthest end, the control unit 115 checks whether adifference between value d[0] of a focus evaluation value in the scanpoint 0 of the farthest end and a value d[1] of a focus evaluation valuein the scan point 1 is equal to or greater than the predetermined valueSlope Thr. The scan point 1 is nearer to the closest distance end sideby one scan point than the scan point 0. If the scan point io is thefarthest end and the difference is to or greater than the predeterminedvalue Slope Thr (YES in step S1308), the processing proceeds to stepS1311. If not both of these conditioned are satisfied (NO in stepS1308), the processing proceeds to step S1309.

In step S1309, the control unit 115 checks whether the length of a partL inclining with a inclination equal to or greater than a constant valueis equal to or greater than a set in advance predetermined value Lo. Ifthe length L is equal to or greater than the predetermined value Lo, thecontrol unit 115 checks whether the average value SL/L is equal to orgreater than the set in advance predetermined value SLo/Lo, and thedifference between the maximum value and the minimum value of the focusevaluation values is equal to or greater than the set in advancepredetermined value. If the length L of a inclined part is equal to orgreater than the predetermined value Lo, and the average value SL/L ofinclination of the inclined part is equal to or greater than thepredetermined value SLo/Lo, and the difference between the maximum valueand the minimum value of the focus evaluation value is equal to orgreater than the predetermined value (YES in step S1309), the processingproceeds to step S1310. On the other hand, if not all of theseconditions described above are satisfied (NO in step S1309), theprocessing proceeds to step S1311.

In step S1310, the control unit 115 sets a determined result to “∘”determination, since all of the determination conditions in steps S1307to S1309 are satisfied, the calculated focus evaluation value has a hillshape, and the focus adjustment of an object is available. In stepS1311, the control unit 115 sets a determined result to “x”determination since either of determination conditions in steps S1307 toS1309 is not satisfied, the calculated focus evaluation value does nothave a hill shape, and the focus adjustment to an object is notavailable. As described above, the imaging apparatus 1 performs thein-focus determination in step S713 in the flowchart of FIG. 7 and stepS811 in the flowchart of FIG. 8.

Next, a subroutine of the shooting operation in step S215 in theflowchart of FIG. 2 will be described below with reference to theflowchart of FIG. 17. As illustrated in FIG. 17, in step S1701, thecontrol unit 115 measures an object luminance, and then the processingproceeds to step S1702. In step S1702, the control unit 115 controls theAE processing unit 103 according to the object luminance measured instep S1701, and performs exposure to the image sensor 108. Then, theprocessing proceeds to step S1703.

An object image formed on an image plane of the image sensor 108 by theexposure in step S1702 is subjected to a photoelectric conversion, andis output to the A/D conversion unit 109 as an analog signal (analogimage data). In step S1703, in the A/D conversion unit 109, analog imagedata from the image sensor 108 is converted into digital image data andoutput, after pre-processing such as output noise elimination andnonlinear processing of the image sensor 108.

In step S1704, the control unit 115 converts digital image data outputfrom the A/D conversion unit 109 to appropriate image data by a whitebalance adjustment of the WE processing unit 111 and image processing ofthe image processing unit 110, and then the processing proceeds to stepS1705. In step S1705, the control unit 115 performs image formatconversion to a format such as JPEG with respect to digital image dataconverted by the format conversion unit 112, and subsequentlytemporarily stores the image data on the DRAM 113. Then, the processingproceeds to step S1706. In step S1706, the control unit 115 stores datawithin the DRAM 113 on a recording medium such as a memory card by theimage recording unit 114. Then, the subroutine of the shooting operationends.

As described above, in the present exemplary embodiment, if it isdetermined that an object is not moving in the distance direction, auseless lens movement can be reduced by stopping the focus lens untilthe object moves in the next moment and a distance from the object haschanged. For this reason, deterioration of visual quality of the EVFdisplay, and battery consumption can be reduced. An in-focus positionwith a low reliability or erroneous in-focus position may have beenobtained. In such a case, further, in the present exemplary embodiment,the cases that a focusing while tracking the object becomes unavailable,can be reduced by refraining from performing prediction of the objectposition.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all modifications, equivalent structures, and functions.

What is claimed is:
 1. An imaging apparatus comprising: an image sensorconfigured to capture an image of an object through a photographicsystem including a focus lens and output image data; a scan unitconfigured to move the focus lens within a predetermined scan range,having a scan center position, defined by a scan-starting point and ascan-ending point; a calculation unit configured to calculate a focusevaluation value based on the image data while the scan unit moves thefocus lens, and to determine a maximal focus evaluation value based onthe focus evaluation value; a control unit configured to adjust thefocus lens to a lens position where the maximal focus evaluation valuewas obtained; and a setting unit configured to set a scan range for anext scan depending on whether a direction of a lens position where themaximal focus evaluation value was obtained in a previous scan to a scancenter position of the scan range in the previous scan is the same as adirection of a lens position where the maximal focus evaluation value isobtained in a present scan to a scan center position of the scan rangefor the present scan, or not.
 2. The imaging apparatus according toclaim 1, wherein, if the direction of the lens position where themaximal focus evaluation value was obtained in the previous scan to thescan center position of the scan range for the previous scan is the sameas the direction of the lens position where the maximal focus evaluationvalue is obtained in the present scan to the scan center position of thescan range for the present scan, the scan range for the next scan is setbased on a prediction calculation.
 3. The imaging apparatus according toclaim 1, wherein, if the direction of the lens position where themaximal focus evaluation value was obtained in the previous scan to thescan center position of the scan range for the previous scan is not thesame as the direction of the lens position where the maximal focusevaluation value is obtained in the present scan to the scan centerposition of the scan range for the present scan, the scan range for anext scan is set so that the scan center position for the next scancoincides with a lens position where the maximal focus evaluation valueis obtained in the present scan.
 4. A method for controlling an imagingapparatus, comprising: capturing an image of an object through aphotographic system including a focus lens and outputting image data;moving the focus lens within a predetermined scan range, having a scancenter position, defined by a scan-starting point and a scan-endingpoint; calculating a focus evaluation value based on the image datawhile moving the focus lens, and determining a maximal focus evaluationvalue based on the focus evaluation value; adjusting the focus lens to alens position where the maximal focus evaluation value was obtained; andsetting a scan range for a next scan depending on whether a direction ofa lens position where the maximal focus evaluation value was obtained ina previous scan to a scan center position of previous scan is the sameas a direction of a lens position corresponding to the maximal focusevaluation value of previous scan of present scan to a scan centerposition of present scan, or not.
 5. The method according to claim 4,wherein, if the direction of the lens position where the maximal focusevaluation value was obtained in the previous scan to the scan centerposition of the scan range for the previous scan is the same as thedirection of the lens position where the maximal focus evaluation valueis obtained in the present scan to the scan center position for thepresent scan, the scan range for a next scan is set based on aprediction calculation.
 6. The method according to claim 4, wherein, ifthe direction of the lens position where the maximal focus evaluationvalue was obtained in the previous scan to the scan center position ofthe can range for the previous can is not the same as the direction ofthe lens position where the maximal focus evaluation value is obtainedin the present scan to the scan center position of the scan range forthe present scan, a scan range for a next scan is set so that the scancenter position for the next scan coincides with a lens position wherethe maximal focus evaluation value is obtained in the present scan. 7.An imaging apparatus comprising: an image sensor configured to capturean image of an object through a photographic system including a focuslens and output image data; a scan unit configured to move the focuslens within a predetermined scan range, having a scan center position,defined by a scan-starting point and a scan-ending point; a calculationunit configured to calculate a focus evaluation value based on the imagedata while the scan unit moves the focus lens, and to determine amaximal focus evaluation value based on the focus evaluation value; acontrol unit configured to adjust the focus lens to a lens positionwhere the maximal focus evaluation value was obtained; and a settingunit configured to set a scan range for a (N+1)st scan depending onwhether a direction of a lens position where the maximal focusevaluation value was obtained in a (N−1)st scan to a can center positionof the scan range for the (N−1)st scan is the same as the direction of alens position where the maximal focus evaluation value obtained in a Nthscan to the scan center position of the scan range for the Nth scan, ornot, wherein N is natural number.
 8. The imaging apparatus according toclaim 7, wherein, if the direction of the lens position where themaximal focus evaluation value was obtained in the (N−1)st scan to thescan center position of the scan range for the (N−1)st scan is the sameas the direction of the lens position where the maximal focus evaluationvalue is obtained in the Nth scan to the scan center position of thescan range for the Nth scan, the scan range for the (N+1)st scan is setbased on a predetermined prediction calculation.
 9. The imagingapparatus according to claim 7, wherein, if the direction of the lensposition where the maximal focus evaluation value was obtained in the(N−1)st scan to the scan center position of the scan range for the(N−1)st scan is not the same as the direction of the lens position wherethe maximal focus evaluation value is obtained in the Nth scan to thescan center position of the scan range for the Nth scan, the scan rangefor a (N+1)st scan is set so that the scan center position for the(N+1)st scan coincides with a lens position where the maximal focusevaluation value is obtained in the Nth scan.
 10. The imaging apparatusaccording to claim 1, wherein, if the direction of the lens positionwhere the maximal focus evaluation value was obtained in the previousscan to the scan center position of the scan range for the previous scanis not the same as the direction of the lens position Where the maximalfocus evaluation value is obtained in the present scan to the scancenter position of the scan range for the present scan, the scan rangefor the next scan is set without using a prediction calculation.
 11. Theimaging apparatus according to claim 7, wherein, if the direction of thelens position where the maximal focus evaluation value was obtained inthe (N−1)st scan to the scan center position of the scan range for the(N−1)st scan is not the same as the direction of the lens position wherethe maximal focus evaluation value is obtained in the Nth scan to thescan center position of the scan range for the Nth scan, the scan rangefor the (N+1)st scan is set without using a predetermined predictioncalculation.
 12. The imaging apparatus according to claim 1, wherein thescan unit is configured to move the focus lens in a one-way directionfrom the scan-starting point to the scan-ending point.
 13. The imagingapparatus according to claim 7, wherein the scan unit is configured tomove the focus lens in a one-way direction from the scan-starting pointto the scan-ending point.
 14. The imaging apparatus according to claim1, wherein the scan unit is configured to obtain a plurality of focusevaluation values including the maximal focus evaluation value by movingthe focus lens for one-way scanning at a predetermined range, includingthe scan center position, defined by the scan-starting point and thescan-ending point, and the predetermined range is narrower than amovement range of the focus lens.
 15. The imaging apparatus according toclaim 7, wherein the scan unit is configured to obtain a plurality offocus evaluation values including the maximal focus evaluation value bymoving the focus lens for one-way scanning at a predetermined range,including the scan center position, defined by the scan-starting pointand the scan-ending point, and the predetermined range is narrower thana movement range of the focus lens.
 16. The imaging apparatus accordingto claim 1, wherein an AF operation by the control unit with the scanunit is not a hill-climbing AF operation.
 17. The imaging apparatusaccording to claim 7, wherein an AF operation by the control unit withthe scan unit is not a hill-climbing AF operation.